package sui.template
{

    public class VariableExp implements IExpression
    {
        private var path:Array;

        public function VariableExp(str:String)
        {
            path = str.split(".")
        }

        public function exec(context:Object):*
        {
            var node:Object = context;
            try
            {
                for (var i:int = 0; i < path.length; i++)
                {
                    node = node[path[i]];
                }
            }
            catch (err:Error)
            {
                node = null;
            }
            return node;
        }
    }
}
